package locations.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

@Entity
public class InstitutionResponsible extends Persona implements Serializable{
	
	private static final long serialVersionUID = -6869277954802222050L;

	protected String profesion;
        
	@OneToMany(mappedBy="responsible") 
	protected Set<Institution> institutions;
	
        public InstitutionResponsible()
        {
            this.setInstitutions(new HashSet<Institution>());
        }
        
        public InstitutionResponsible(String profesion)
        {
            this();
            this.setProfesion(profesion);
        }
        
        public InstitutionResponsible(String name, String lastName, String email, String phoneNumbers, String profesion)
        {
            this();
            this.setNombre(name);
            this.setApellido(lastName);
            this.setEmail(email);
            this.setPhoneNumbers(phoneNumbers);
            this.setProfesion(profesion);
        }

	public String getProfesion() {
		return profesion;
	}

	public void setProfesion(String profesion) {
		this.profesion = profesion;
	}

	public Set<Institution> getInstitutions() {
		return institutions;
	}

	public void setInstitutions(Set<Institution> institutions) {
		this.institutions = institutions;
	}

	public String toString(){
		return this.getApellido() + "," + this.getNombre();
	}
        
        public boolean addInstitution(Institution institution)
        {
            return this.getInstitutions().add(institution);
        }
        
        public boolean removeInstitution(Institution institution)
        {
            return this.getInstitutions().remove(institution);
        }

}
